package com.ruoyi.project.wechatprogram.picture.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.project.wechatprogram.picture.mapper.WxPictureMapper;
import com.ruoyi.project.wechatprogram.picture.domain.WxPicture;
import com.ruoyi.project.wechatprogram.picture.service.IWxPictureService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 轮播图Service业务层处理
 * 
 * @author sxchen
 * @date 2020-05-06
 */
@Service
public class WxPictureServiceImpl implements IWxPictureService 
{
    @Autowired
    private WxPictureMapper wxPictureMapper;

    /**
     * 查询轮播图
     * 
     * @param picId 轮播图ID
     * @return 轮播图
     */
    @Override
    public WxPicture selectWxPictureById(Integer picId)
    {
        return wxPictureMapper.selectWxPictureById(picId);
    }

    /**
     * 查询轮播图列表
     * 
     * @param wxPicture 轮播图
     * @return 轮播图
     */
    @Override
    public List<WxPicture> selectWxPictureList(WxPicture wxPicture)
    {
        return wxPictureMapper.selectWxPictureList(wxPicture);
    }

    /**
     * 新增轮播图
     * 
     * @param wxPicture 轮播图
     * @return 结果
     */
    @Override
    public int insertWxPicture(WxPicture wxPicture)
    {
        wxPicture.setCreateTime(DateUtils.getNowDate());
        return wxPictureMapper.insertWxPicture(wxPicture);
    }

    /**
     * 修改轮播图
     * 
     * @param wxPicture 轮播图
     * @return 结果
     */
    @Override
    public int updateWxPicture(WxPicture wxPicture)
    {
        wxPicture.setUpdateTime(DateUtils.getNowDate());
        return wxPictureMapper.updateWxPicture(wxPicture);
    }

    /**
     * 删除轮播图对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWxPictureByIds(String ids)
    {
        return wxPictureMapper.deleteWxPictureByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除轮播图信息
     * 
     * @param picId 轮播图ID
     * @return 结果
     */
    @Override
    public int deleteWxPictureById(Integer picId)
    {
        return wxPictureMapper.deleteWxPictureById(picId);
    }
}
